﻿<Window x:Class="PdfRotator.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:converter="clr-namespace:PdfRotator.Converter"
        Title="Pdf Rotator" Height="350" Width="600"
        AllowDrop="True" Drop="Window_Drop" DragOver="Window_DragOver">
    <Window.Resources>
        <converter:EnumToDescriptionConverter x:Key="EnumConverter"/>
    </Window.Resources>
    <DockPanel>
        <StackPanel DockPanel.Dock="Right" Margin="10" MinWidth="170">
            <StackPanel.Resources>
                <Style TargetType="{x:Type Label}" BasedOn="{StaticResource ResourceKey={x:Type Label}}">
                    <Setter Property="Margin" Value="0,0,0,5"/>
                    <Setter Property="Padding" Value="0"/>
                </Style>
                <Style TargetType="{x:Type ComboBox}" BasedOn="{StaticResource ResourceKey={x:Type ComboBox}}">
                    <Setter Property="Margin" Value="10,0,0,20"/>
                    <Setter Property="Padding" Value="5"/>
                </Style>
                <Style TargetType="{x:Type Button}" BasedOn="{StaticResource ResourceKey={x:Type Button}}">
                    <Setter Property="Margin" Value="0,10,0,0"/>
                    <Setter Property="Padding" Value="20,5"/>
                    <Setter Property="HorizontalAlignment" Value="Right"/>
                </Style>
            </StackPanel.Resources>
            <Label Content="Odd pages"/>
            <ComboBox IsEditable="False"
                      ItemsSource="{Binding Rotations}"
                      SelectedValuePath="Value"
                      DisplayMemberPath="Description"
                      SelectedValue="{Binding OddPageRotation}"/>
            <Label Content="Even pages"/>
            <ComboBox IsEditable="False"
                      ItemsSource="{Binding Rotations}"
                      SelectedValuePath="Value"
                      DisplayMemberPath="Description"
                      SelectedValue="{Binding EvenPageRotation}"/>
            <Button Name="ButtonRotate" Content="Rotate" Click="ButtonRotate_Click" />
        </StackPanel>
        <ListView ItemsSource="{Binding Files}" SizeChanged="ListView_SizeChanged">
            <ListView.ItemContainerStyle>
                <Style TargetType="ListViewItem">
                    <Setter Property="HorizontalContentAlignment" Value="Stretch" />
                </Style>
            </ListView.ItemContainerStyle>
            <ListView.View>
                <GridView>
                    <GridView.ColumnHeaderContainerStyle>
                        <Style TargetType="GridViewColumnHeader">
                            <Setter Property="Padding" Value="5,2"/>
                            <Setter Property="HorizontalContentAlignment" Value="Left"/>
                        </Style>
                    </GridView.ColumnHeaderContainerStyle>
                    <GridViewColumn x:Name="GridViewColumnFile" Header="Pdf File">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Name}" ToolTip="{Binding Path}" />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                    <GridViewColumn x:Name="GridViewColumnStatus" Header="Status" Width="80">
                        <GridViewColumn.CellTemplate>
                            <DataTemplate>
                                <TextBlock Text="{Binding Status, Converter={StaticResource EnumConverter}}" />
                            </DataTemplate>
                        </GridViewColumn.CellTemplate>
                    </GridViewColumn>
                </GridView>
            </ListView.View>
        </ListView>
    </DockPanel>
</Window>
